package com.wzh.chatgpt.data.config;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

/**
 * @author: wzh
 * time 2023 12 15 19 53
 **/
@Configuration
public class GoogleGuavaCodeCacheConfig {

    @Bean("codeCache")
    public Cache<String,String> codeCache(){
        return CacheBuilder.newBuilder().expireAfterWrite(3, TimeUnit.MINUTES).build();
    }
}
